WriteSlaveAlias

Writes an alias address into an EtherCAT slave.

Syntax

KsCommandStatus WriteSlaveAlias(
     int SlaveId,
     WORD Alias
);

Parameters

SlaveId: the index of a slave array. When EtherCAT is started, this index has the same value as the SlaveId, which corresponds to the position of the slave in the network. Please note that after EtherCAT is started in the Operational (Op) state, any addition or removal of slaves from the network will change the position of the slaves in the network (SlaveId). Nevertheless, the index of the slave will remain the same. Newly added devices will be added in the back of the slave array. For all slaves after the change, the index and SlaveId will no longer match. This behavior is only available for physical devices; simulated devices are inapplicable. Please refer to the use cases in EnableHotConnect for more details.

Alias: the alias address to use. See the AliasAddress in the SlaveStatus structure.

Return value

Returns the KsCommandStatus structure.

Remarks

Some EtherCAT slaves don't accept alias address being modified. If the master writes a value that is not acceptable to the slave, the slave may display an error and refuse to start.

Usable EtherCAT states

ecatInit, ecatPreOP, ecatSafeOP, ecatOP

Example

Copy
const WORD newAlias = 5;
WaitForCommand(3, TRUE, WriteSlaveAlias(0, newAlias));

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

ReadSlaveAlias